#ifndef __OUTPUT_H
#define __OUTPUT_H

#include "Types.h"
#include <stdbool.h>

#define CHARMAP  0x0400
#define COLORMAP 0xD800

extern byte_t _pos_x;
extern byte_t _pos_y;
extern byte_t _fore_color;
extern bool _reverse_on;

extern const char _c[];

//void __fastcall__ writenumber(int n);
void __fastcall__ writenumberxy(byte_t x, byte_t y, long n);

void __fastcall__ beginDoubleBuffer(void);
void __fastcall__ endDoubleBuffer(void);

byte_t __fastcall__ getScreenCode(char source, bool reverse);
void __fastcall__ getScreenCodes(char *target, char *source, byte_t length, bool reverse);

//void movexy(byte_t x, byte_t y);

void plotcode(byte_t screenCode);
void plotcodexy(byte_t x, byte_t y, byte_t screenCode);

byte_t __fastcall__ codeat(byte_t x, byte_t y);

void plotascii(char ascii);
void plotasciixy(byte_t x, byte_t y, char ascii);

void writestringxy(byte_t x, byte_t y, char *string);

bool clearxy(byte_t x, byte_t y, uint_t len);

void moveright(byte_t x, byte_t y, uint_t len, uint_t dist);
void moveleft(byte_t x, byte_t y, uint_t len, uint_t dist);
void moveup(byte_t x, byte_t y, uint_t len, uint_t dist);
void movedown(byte_t x, byte_t y, uint_t len, uint_t dist);

void moveline(char* sourcemap, byte_t x, byte_t y, byte_t w, 
			  char* targetmap, byte_t tx, byte_t ty);
void moveregion(byte_t x, byte_t y, byte_t w, byte_t h, byte_t tx, byte_t ty);

void clearscreen();

#endif